<style>
    table th, table td{
        text-align: center !important;
    }
    .page-content .portlet .portlet-search-body .search-item{
        width: 15%;
    }
</style>

<div class="portlet">
    <div class="portlet-actions">
        <button class="btn btn-sm blue rounded" ng-click="add()"><i class="fa fa-plus"></i> 新增</button>
        <button class="btn btn-sm btn-default rounded" onclick="$('#type_table').treetable('expandAll');">全部展开</button>
        <button class="btn btn-sm btn-default rounded" onclick="$('#type_table').treetable('collapseAll');">全部折叠</button>
    </div>
    <div class="portlet-body">
        <table id="type_table" class="table table-striped table-bordered table-advance table-hover">
            <thead>
                <tr>
                    <th>类型</th>
                    <th>单位</th>
                    <th>预警数量</th>
                    <th width="140px">操作</th>
                </tr>
            </thead>

            <tbody>
                <tr ng-repeat="type in types" ng-click="select(type.typeId)" data-tt-id="{{type.typeId}}" data-tt-parent-id='{{type.parentTypeId}}' on-finish-render-filters>
                    <td style="text-align: left !important; width: 500px">{{type.typeName}}</td>
                    <td >{{type.unit}}</td>
                    <td>{{type.alertNum}}</td>
                    <td style="width: 300px">
                        <button class="btn btn-xs btn-warning rounded" ng-click="edit(type)"><i class="fa fa-edit"></i> 编辑</button>
                        <button class="btn btn-xs btn-danger rounded" ng-click="delete(type)"><i class="fa fa-trash-o"></i> 删除</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<div ed-modal="modal" data-options="title: 'xxxx', static: true, width: 720, defaultButton:false,onHidden:'reset'">
    <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="validateForm">
        <div class="form-body">
        	<div class="form-group">
				<label class="col-md-2 control-label"><span style="color:red">* </span>类型</label>
				<div class="col-md-4">
					<input type="text" class="form-control" name="typeName" ng-model="type.typeName" required>
            	</div>

                <label class="col-md-2 control-label">上级类型</label>
                <div class="col-md-4">
                    <div ed-combotree data-options="idField: 'typeId', textField: 'typeName', parentIdField: 'parentTypeId'"
                         ed-data="types" ng-model="type.parentTypeId" placeholder="请选择"></div>
                </div>
            </div>
        	<div class="form-group">
				<label class="col-md-2 control-label">单位</label>
				<div class="col-md-4">
					<input type="text" class="form-control" name="unit" ng-model="type.unit">
            	</div>
                <label class="col-md-2 control-label">预警数量</label>
				<div class="col-md-4">
					<input type="text" class="form-control" name="alertNum" ng-model="type.alertNum" pattern="^(0|[1-9][0-9]*)$">
            	</div>
			</div>
        </div>
        <div class="form-actions">
            <button type="button" class="btn default" ng-click="cancel();">
                <i class="fa fa-times"></i> 取消
            </button>
            <button type="button" class="btn blue" w5c-form-submit="save();">
                <i class="fa fa-check"></i> 确定
            </button>
        </div>
    </form>
</div>
